package com.mytools.common;

public class Result {
    private static final String SUCCESS = "200";
    private static final String ERROR = "0";
    private String code;
    private String msg;
    private Object data;

    public static Result success() {
        Result r = new Result();
        r.setCode(SUCCESS);
        return r;
    }

    public static Result success(Object data) {
        Result r = new Result();
        r.setCode(SUCCESS);
        r.setData(data);
        return r;
    }
    public static Result error(String msg){
        Result r = new Result();
        r.setCode(ERROR);
        r.setMsg(msg);
        return r;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
